DefaultUser, DefaultPassword Properties Example

This example sets the DefaultUser and DefaultPassword properties which will determine the settings for the default Workspace object.

Sub DefaultUserX()

   ' Set the DefaultUser and DefaultPassword properties for 
   ' the DBEngine object.
   DBEngine.DefaultUser = "NewUser"
   DBEngine.DefaultPassword = ""

   Debug.Print _
      "Setting DBEngine.DefaultUser to 'NewUser'..."
   Debug.Print _
      "Setting DBEngine.DefaultPassword to " & _
         "[zero-length string]..."

   Dim wrkJet As Workspace
   Dim wrkLoop As Workspace
   Dim prpLoop As Property

   Set wrkJet = CreateWorkspace("JetWorkspace", "admin", _
      "", dbUseJet)

   ' Enumerate Workspaces collection.
   On Error Resume Next
   For Each wrkLoop In Workspaces
      Debug.Print "Workspace: " & wrkLoop.Name
      ' Enumerate Properties collection of each Workspace 
      ' object.
      For Each prpLoop In wrkLoop.Properties
         Debug.Print "  " & prpLoop.Name & " = " & prpLoop
      Next prpLoop
   Next wrkLoop
   On Error GoTo 0

   wrkJet.Close

End Sub